home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGSCAL
/
TPAINT2.LZH
/
CONVERT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1986-03-15
|
4KB
|
95 lines
(* **************************************************** *)
(* *)
(* CONVERT.PAS *)
(* *)
(* This Program will convert screens with headers, *)
(* such as those saved by PC Paint (uncompressed), *)
(* Polaroid Palette, and BASIC's BSave into files *)
(* that can be displayed directly in a Turbo Pascal *)
(* program. The basic idea is to load the file into *)
(* a Buffer and then move the bytes beyond the *)
(* header file to the color screen. *)
(* The usual offset is 7 (PC Paint) or 8 (Polaroid) *)
(* bytes. *)
(* This procedure may fail if the file size is less *)
(* than the array size declared for ScreenType. In *)
(* that case EOF will be encountered before expected. *)
(* ScreenType may be declared to be a smaller array *)
(* size (say, 16,191 bytes) and the program should *)
(* then work. *)
(* How nice it is to be able to use a paint program *)
(* to create screens for your Turbo Pascal programs! *)
(* *)
(* (c) Donald L. Pavia *)
(* Depatment of Chemistry *)
(* March 1986 Western Washington University *)
(* Bellingham, Washington 98225 *)
(* *)
(* **************************************************** *)
program ConvertScreens;
{----------------------------------------------------------------------------}
{$I LoadSave.Lib}
{----------------------------------------------------------------------------}
var FilName,NewName : str255;
Color,Pal,Bckg : integer;
ScrnMode,Save,Wait : char;
Buffer : ScreenType;
procedure ConvertScreen (FileName : str255; OffSet : byte);
var DisplayFile : ScreenFile;
begin
assign (DisplayFile,FileName);
reset (DisplayFile);
read (DisplayFile,Buffer);
close (DisplayFile);
move (Buffer[Offset],Screen,16200);
end;
{----------------------------------------------------------------------------}
begin
clrscr; writeln;
write (' Enter FileName of Disk File : '); readln (FilName);
writeln;
write (' (1) Med Res or (2) HiRes ? : '); readln (ScrnMode);
if ScrnMode = '1' then begin
write (' Choice of Palette (0..3) ? : '); readln (Pal);
write (' Background Color (0..15) ? : '); readln (Bckg);
writeln end;
if ScrnMode = '2' then begin
write (' Choice of HiResColor (0..15) ? : '); readln (Color);
writeln end;
write (' Give Byte Offset [0 (Turbo), 7 (PCPaint,BSave), 8 (PSaver)] : ');
read (Offset); writeln; writeln;
write (' Save Image to Disk with New Name? Y/N ? : ');
read (Kbd,Save); writeln;
if UpCase(Save) = 'Y' then
begin write (' New FileName : '); read (NewName) end;
writeln;
writeln (' Press <RETURN> to See Result !!!! ');
write (' Then Press Again to End Program ');
read (Kbd,Wait);
case ScrnMode of
'1' : begin Graphcolormode; Palette (Pal); GraphBackground (Bckg) end;
'2' : begin HiRes; HiResColor (Color) end;
end;
ConvertScreen (FilName,OffSet); read (Kbd,Wait);
if UpCase(Save) = 'Y' then SaveScreen (NewName);
TextMode (c80); clrscr;
end.